﻿<!DOCTYPE html>
<html class="theme theme-white">
<head>
<meta charset="utf-8">
<title>工具类使用文档</title>
<link href="https://www.zybuluo.com/static/assets/template-theme-white.css" rel="stylesheet" media="screen">
<style type="text/css">

#wmd-preview h1  {
    color: #0077bb; /* 将标题改为蓝色 */
}</style>
</head>
<body class="theme theme-white">
<div id="wmd-preview" class="wmd-preview wmd-preview-full-reader"><div class="md-section-divider"></div><div class="md-section-divider"></div><h1 data-anchor-id="qi8q" id="工具类使用文档">工具类使用文档</h1><p data-anchor-id="3xgc"><code>未分类</code></p><hr><blockquote data-anchor-id="koyd" class="white-blockquote">
  <p>模拟发送http请求</p>
</blockquote><p data-anchor-id="4lgy"><a href="#URL%E5%8F%91%E9%80%81%E8%AF%B7%E6%B1%82">URL发送请求</a> <br>
<a href="#httpclient%E6%A8%A1%E6%8B%9F%E5%8F%91%E9%80%81http%E7%9A%84post%E8%AF%B7%E6%B1%82">httpclient模拟发送http的post请求</a></p><blockquote data-anchor-id="b02x" class="white-blockquote">
  <p>客户端判断工具</p>
</blockquote><p data-anchor-id="7eih"><a href="#%E5%88%A4%E6%96%AD%E8%AF%A5%E8%AF%B7%E6%B1%82%E6%98%AF%E5%90%A6%E6%9D%A5%E8%87%AA%E6%89%8B%E6%9C%BA%E7%BB%88%E7%AB%AF">判断该请求是否来自手机终端</a>    </p><blockquote data-anchor-id="fgzm" class="white-blockquote">
  <p>集合工具类</p>
</blockquote><p data-anchor-id="or9t"><a href="#%E5%B0%86list%E6%8B%86%E5%88%86%E6%88%90%E5%9B%BA%E5%AE%9A%E5%A4%A7%E5%B0%8F%E7%9A%84%E5%9D%97">将list拆分成固定大小的块</a></p><blockquote data-anchor-id="6l22" class="white-blockquote">
  <p>cookie工具类</p>
</blockquote><p data-anchor-id="hfrs"><a href="#%E8%8E%B7%E5%8F%96cookie">获取cookie</a> <br>
<a href="#%E8%8E%B7%E5%8F%96cookie">删除cookie</a></p><blockquote data-anchor-id="yo2d" class="white-blockquote">
  <p>日期工具类</p>
</blockquote><p data-anchor-id="e898"><a href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E5%B9%B4%E7%9A%84%E5%89%8Dn%E5%B9%B4%E5%88%97%E8%A1%A8">获取当前年的前n年列表</a> <br>
<a href="#%E8%8E%B7%E5%8F%9612%E4%B8%AA%E6%9C%88%E7%9A%84%E9%9B%86%E5%90%88">获取12个月的集合</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%98%8E%E5%A4%A9%E7%9A%84%E6%97%A5%E6%9C%9F">获取明天的日期</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%8C%87%E5%AE%9A%E6%97%A5%E6%9C%9Fn%E5%A4%A9%E5%90%8E%E7%9A%84%E6%97%A5%E6%9C%9F">获取指定日期n天后的日期</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%8C%87%E5%AE%9A%E6%97%A5%E6%9C%9F00:00:00%E6%97%B6%E5%88%BB%E7%9A%84n%E5%A4%A9%E5%90%8E%E6%97%A5%E6%9C%9F">获取指定日期00:00:00时刻的n天后日期</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%8C%87%E5%AE%9A%E6%97%A5%E6%9C%9F23:59:59%E6%97%B6%E5%88%BB%E7%9A%84n%E5%A4%A9%E5%90%8E%E6%97%A5%E6%9C%9F">获取指定日期23:59:59时刻的n天后日期</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%8C%87%E5%AE%9A%E6%97%A5%E6%9C%9Fn%E5%A4%A9%E5%89%8D%E7%9A%84%E6%97%A5%E6%9C%9F">获取指定日期n天前的日期</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%8C%87%E5%AE%9A%E6%97%A5%E6%9C%9F00:00:00%E6%97%B6%E5%88%BB%E7%9A%84n%E5%A4%A9%E5%89%8D%E6%97%A5%E6%9C%9F">获取指定日期00:00:00时刻的n天前日期</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%8C%87%E5%AE%9A%E6%97%A5%E6%9C%9F23:59:59%E6%97%B6%E5%88%BB%E7%9A%84n%E5%A4%A9%E5%89%8D%E6%97%A5%E6%9C%9F">获取指定日期23:59:59时刻的n天前日期</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E6%97%A5%E6%9C%9F%E5%89%8Dx%E5%A4%A9%E7%9A%84%E6%97%A5%E6%9C%9F">获取当前日期前x天的日期</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E5%B9%B4">获取当前年</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E6%9C%88">获取当前月</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%9F%90%E5%B9%B4%E6%9F%90%E6%9C%88%E7%9A%84%E7%AC%AC%E4%B8%80%E5%A4%A9%E5%92%8C%E6%9C%80%E5%90%8E%E4%B8%80%E5%A4%A9%E6%97%B6%E9%97%B4">获取某年某月的第一天和最后一天时间</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E6%9C%88%E4%BB%BD%E7%9A%84%E5%89%8D%E4%B8%80%E4%B8%AA%E6%9C%88">获取当前月份的前一个月</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%9F%90%E5%B9%B4%E6%9F%90%E6%9C%88%E7%9A%84%E5%89%8D%E4%B8%80%E4%B8%AA%E6%9C%88">获取某年某月的前一个月</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E5%BC%80%E5%A7%8B%E6%9C%88%E4%BB%BD%E5%92%8C%E7%BB%93%E6%9D%9F%E6%9C%88%E4%BB%BD%E4%B8%AD%E9%97%B4%E7%9A%84%E6%89%80%E6%9C%89%E6%9C%88%E4%BB%BD%EF%BC%8C%E5%8C%85%E6%8B%AC%E5%BC%80%E5%A7%8B%E6%9C%88%E4%BB%BD%E5%92%8C%E7%BB%93%E6%9D%9F%E6%9C%88%E4%BB%BD">获取开始月份和结束月份中间的所有月份，包括开始月份和结束月份</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%97%A5%E6%9C%9F%E4%B9%8B%E9%97%B4%E7%9A%84%E5%A4%A9List%20formt%20=yyyy-MM-dd">获取日期之间的天List formt =yyyy-MM-dd</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%97%A5%E6%9C%9F%E4%B9%8B%E9%97%B4%E7%9A%84%E5%A4%A9List%20%E8%BE%93%E5%87%BA%E6%8C%87%E5%AE%9A%E6%97%A5%E6%9C%9F%E6%A0%BC%E5%BC%8F">获取日期之间的天List 输出指定日期格式</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E6%97%A5%E6%9C%9F%E7%9A%84%E5%89%8Dn%E4%B8%AA%E6%9C%88%E7%9A%84%E6%9C%88%E4%BB%BD%E9%9B%86%E5%90%88%EF%BC%88%E9%97%AD%E5%8C%BA%E9%97%B4%EF%BC%89">获取当前日期的前n个月的月份集合（闭区间）</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E5%A4%A9">获取当前天</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E6%9C%88%E7%9A%84%E7%AC%AC%E4%B8%80%E5%A4%A9">获取当前月的第一天</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E6%9C%88%E7%9A%84%E6%9C%80%E5%90%8E%E4%B8%80%E5%A4%A9">获取当前月的最后一天</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E6%9C%88%E7%9A%84%E7%AC%AC%E4%B8%80%E5%A4%A9%E8%BF%94%E5%9B%9EDate%E7%B1%BB%E5%9E%8B">获取当前月的第一天返回Date类型</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E6%9C%88%E7%9A%84%E6%9C%80%E5%90%8E%E4%B8%80%E5%A4%A9%E8%BF%94%E5%9B%9EDate%E7%B1%BB%E5%9E%8B">获取当前月的最后一天返回Date类型</a> <br>
<a href="#%E5%88%A4%E6%96%AD%E6%97%A5%E6%9C%9F%E7%9A%84%E5%A4%A9%E6%98%AF%E5%90%A6%E4%B8%80%E6%A0%B7">判断日期的天是否一样</a> <br>
<a href="#%E5%88%A4%E6%96%AD%E4%B8%A4%E6%97%A5%E6%9C%9F%E9%97%B4%E8%B7%9D%E6%98%AF%E5%90%A6%E4%B8%BAxx%E6%AF%AB%E7%A7%92">判断两日期间距是否为xx毫秒</a> <br>
<a href="#%E6%97%B6%E9%97%B4%E9%97%B4%E8%B7%9D%E6%98%AF%E5%90%A6%E5%9C%A8%20startSpace%20%E5%92%8C%20endSpace%20%E4%B9%8B%E9%97%B4">判断两日期间距是否在 startSpace毫秒 和 endSpace毫秒 之间</a> <br>
<a href="#%E5%88%A4%E6%96%AD%E6%97%A5%E6%9C%9F%E6%98%AF%E5%90%A6%E5%9C%A8startTime%E5%92%8CendTime%E6%97%A5%E6%9C%9F%E4%B9%8B%E9%97%B4">判断日期是否在startTime和endTime日期之间</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%97%A5%E6%9C%9F%E4%B9%8B%E9%97%B4%E7%9B%B8%E9%9A%94%E5%87%A0%E5%B9%B4">获取日期之间相隔几年</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%97%A5%E6%9C%9F%E4%B9%8B%E9%97%B4%E5%A4%A9%E7%9B%B8%E9%9A%94%E5%87%A0%E5%A4%A9">获取日期之间天相隔几天</a> <br>
<a href="#%20%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E6%97%A5%E6%9C%9F%20%E6%AF%AB%E7%A7%92%E6%88%96%E6%97%B6%E9%97%B4%E6%88%B3">获取当前日期 毫秒或时间戳</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E6%97%A5%E6%9C%9F%20%E7%A7%92">获取当前日期 秒</a></p><blockquote data-anchor-id="slkp" class="white-blockquote">
  <p>文件处理</p>
</blockquote><p data-anchor-id="q166"><a href="#%E6%9C%AC%E5%9C%B0%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0">本地文件上传</a> <br>
<a href="#%E7%94%9F%E6%88%90%E6%9C%AC%E5%9C%B0%E6%96%87%E4%BB%B6">生成本地文件</a> <br>
<a href="#ftp%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6">ftp上传文件</a> <br>
<a href="#ftp%E5%88%A0%E9%99%A4%E6%96%87%E4%BB%B6">ftp删除文件</a></p><blockquote data-anchor-id="jrxl" class="white-blockquote">
  <p>加密处理</p>
</blockquote><p data-anchor-id="6sd8"><a href="#md5%E5%8A%A0%E5%AF%86">md5加密</a> <br>
<a href="#SHA-1%E5%8A%A0%E5%AF%86">SHA-1加密</a> <br>
<a href="#%E4%BD%BF%E7%94%A8AES%E6%A8%A1%E5%BC%8F%E5%8A%A0%E5%AF%86">使用AES模式加密</a> <br>
<a href="#%E8%A7%A3%E5%AF%86AES%E6%A8%A1%E5%BC%8F%E7%9A%84%E5%8A%A0%E5%AF%86">解密AES模式的加密</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6">获取配置文件</a></p><blockquote data-anchor-id="a0rv" class="white-blockquote">
  <p>随机数</p>
</blockquote><p data-anchor-id="gvs7"><a href="#%E6%A0%B9%E6%8D%AE%E6%97%B6%E9%97%B4%E7%94%9F%E6%88%90%E5%94%AF%E4%B8%80%E7%BC%96%E7%A0%81%28%E8%80%83%E8%99%91%E5%B9%B6%E5%8F%91%29">根据时间生成唯一编码(考虑并发)</a> <br>
<a href="#%E7%94%9F%E6%88%90%E9%95%BF%E5%BA%A6%E4%B8%BAlength%E7%9A%84%E5%AD%97%E7%AC%A6%E4%B8%B2">生成长度为length的字符串</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E6%8C%87%E5%AE%9A%E5%8C%BA%E9%97%B4%E7%9A%84%E9%9A%8F%E6%9C%BA%E6%95%B0">获取指定区间的随机数</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E9%9A%8F%E6%9C%BA%E8%89%B2">获取随机色</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E9%95%BF%E5%BA%A6n%E7%9A%84%E9%9A%8F%E6%9C%BA%E6%95%B0%E5%AD%97%E7%AC%A6%E4%B8%B2">获取长度n的随机数字符串</a></p><blockquote data-anchor-id="0y21" class="white-blockquote">
  <p>排序</p>
</blockquote><p data-anchor-id="k79p"><a href="#map%E6%8C%89%E9%94%AE%E8%BF%9B%E8%A1%8C%E7%9A%84ASCII%20%E7%A0%81%E4%BB%8E%E5%B0%8F%E5%88%B0%E5%A4%A7%E6%8E%92%E5%BA%8F%EF%BC%88%E5%AD%97%E5%85%B8%E5%BA%8F%EF%BC%89%E5%90%8E%EF%BC%8C%E5%B0%86%E9%94%AE%E5%80%BC%E5%AF%B9%E6%8C%89key1=value1&amp;key2=value2%E2%80%A6%E6%8B%BC%E6%8E%A5">map按键进行的ASCII 码从小到大排序（字典序）后，将键值对按key1=value1&amp;key2=value2…拼接</a> <br>
<a href="#map%E6%8C%89%E5%80%BC%E8%BF%9B%E8%A1%8C%E7%9A%84ASCII%20%E7%A0%81%E4%BB%8E%E5%B0%8F%E5%88%B0%E5%A4%A7%E6%8E%92%E5%BA%8F%EF%BC%88%E5%AD%97%E5%85%B8%E5%BA%8F%EF%BC%89%E5%90%8E%EF%BC%8C%E5%B0%86%E9%94%AE%E5%80%BC%E5%AF%B9%E6%8C%89key1=value1&amp;key2=value2%E2%80%A6%E6%8B%BC%E6%8E%A5">map按值进行的ASCII 码从小到大排序（字典序）后，将键值对按key1=value1&amp;key2=value2…拼接</a> <br>
<a href="#%E5%B0%86map%E6%8C%89%E9%94%AE%E4%BB%8E%E5%B0%8F%E5%88%B0%E5%A4%A7%E6%8E%92%E5%BA%8F">将map按键从小到大排序</a> <br>
<a href="#%E5%B0%86map%E6%8C%89%E9%94%AE%E4%BB%8E%E5%A4%A7%E5%88%B0%E5%B0%8F%E6%8E%92%E5%BA%8F">将map按键从大到小排序</a> <br>
<a href="#%E5%B0%86List%E6%8C%89%E5%80%BC%E4%BB%8E%E5%B0%8F%E5%88%B0%E5%A4%A7%E6%8E%92%E5%BA%8F">将List按值从小到大排序</a> <br>
<a href="#%E5%B0%86List%E6%8C%89%E5%80%BC%E4%BB%8E%E5%A4%A7%E5%88%B0%E5%B0%8F%E6%8E%92%E5%BA%8F">将List按值从大到小排序</a></p><blockquote data-anchor-id="u2u5" class="white-blockquote">
  <p>类型转换</p>
</blockquote><p data-anchor-id="k0i2"><a href="#Map%3CString,%20String%3E%E8%BD%AC%E6%88%90xml">Map转成xml</a> <br>
<a href="#%E5%B0%86xml%E5%AD%97%E7%AC%A6%E4%B8%B2%E8%BD%AC%E6%8D%A2%E6%88%90Map%3CString,%20String%3E">将xml字符串转换成Map</a> <br>
<a href="#%E5%B0%86json%E5%AD%97%E7%AC%A6%E4%B8%B2%E8%BD%AC%E6%8D%A2%E4%B8%BA%E6%8C%87%E5%AE%9A%E7%B1%BB%E5%9E%8B%E7%9A%84%E5%AF%B9%E8%B1%A1">将json字符串转换为指定类型的对象</a> <br>
<a href="#%E5%B0%86%E5%AF%B9%E8%B1%A1%E8%BD%AC%E6%8D%A2%E4%B8%BAjson%E5%AD%97%E7%AC%A6%E4%B8%B2">将对象转换为json字符串</a> <br>
<a href="#%E5%B0%86%E5%AF%B9%E8%B1%A1%E8%BD%AC%E4%B8%BAmap">将对象转为map</a> <br>
<a href="#%E5%B0%86map%E8%BD%AC%E6%8D%A2%E4%B8%BAbean">将map转换为bean</a> <br>
<a href="#%E5%B0%86maplist%E8%BD%AC%E6%8D%A2%E4%B8%BAbeanlist">将maplist转换为beanlist</a> <br>
<a href="#%E8%BD%AC%E6%8D%A2%E6%9C%89%E4%B8%8B%E5%88%92%E7%BA%BF%E7%9A%84String%20%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%AD%97%E6%AF%8D%E5%A4%A7%E5%86%99%20%E4%B8%8B%E5%88%92%E7%BA%BF%E7%9A%84%E5%90%8E%E4%B8%80%E4%B8%AA%E5%AD%97%E6%AF%8D%E5%A4%A7%E5%86%99">转换有下划线的String 第一个字母大写 下划线的后一个字母大写</a> <br>
<a href="#%E8%BD%AC%E6%8D%A2%E5%B0%86%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%AD%97%E6%AF%8D%E5%A4%A7%E5%86%99%E5%8F%98%E6%88%90%E5%B0%8F%E5%86%99%EF%BC%8C%E5%B9%B6%E5%9C%A8%E5%89%8D%E9%9D%A2%E5%8A%A0%E4%B8%8B%E5%88%92%E7%BA%BF">转换将第一个字母大写变成小写 并在前面加下划线</a> <br>
<a href="#%E9%A6%96%E5%AD%97%E6%AF%8D%E5%8F%98%E5%A4%A7%E5%86%99">首字母变大写</a> <br>
<a href="#%E9%A6%96%E5%AD%97%E6%AF%8D%E5%8F%98%E5%B0%8F%E5%86%99">首字母变小写</a></p><blockquote data-anchor-id="grax" class="white-blockquote">
  <p>验证工具类</p>
</blockquote><p data-anchor-id="7svg"><a href="#%E5%AD%97%E7%AC%A6%E4%B8%B2%E4%B8%AD%E5%AD%97%E7%AC%A6%E6%9B%BF%E6%8D%A2%28%3C,%3E,&amp;,%22%22%E6%9B%BF%E6%8D%A2%29">字符串中字符替换(&lt;,&gt;,&amp;,""替换)</a> <br>
<a href="#html%E6%A0%87%E7%AD%BE%E5%86%85%E5%AE%B9%E6%8F%90%E5%8F%96">html标签内容提取</a> <br>
<a href="#%E5%88%A4%E6%96%AD%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%98%AF%E5%90%A6%E6%98%AF%E6%95%B0%E5%AD%97%E5%AD%97%E7%AC%A6%E4%B8%B2">判断字符串是否是数字字符串</a> <br>
<a href="#%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%AF%B9%E8%B1%A1%E6%98%AF%E5%90%A6%E4%B8%BA%E7%A9%BA%28null%E6%88%96%22%22%29">字符串对象是否为空(null或"")</a> <br>
<a href="#%E7%9B%AE%E6%A0%87%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%98%AF%E5%90%A6%E4%B8%8D%E4%B8%BA%E7%A9%BA">目标字符串是否不为空</a> <br>
<a href="#%E9%AA%8C%E8%AF%81Email">验证Email</a> <br>
<a href="#%E9%AA%8C%E8%AF%81%E8%BA%AB%E4%BB%BD%E8%AF%81%E5%8F%B7%E7%A0%81">验证身份证号码</a> <br>
<a href="#%E9%AA%8C%E8%AF%81%E6%89%8B%E6%9C%BA%E5%8F%B7%E7%A0%81">验证手机号码</a> <br>
<a href="#%E9%AA%8C%E8%AF%81%E5%9B%BA%E5%AE%9A%E7%94%B5%E8%AF%9D%E5%8F%B7%E7%A0%81">验证固定电话号码</a> <br>
<a href="#%E9%AA%8C%E8%AF%81%E6%95%B4%E6%95%B0%EF%BC%88%E6%AD%A3%E6%95%B4%E6%95%B0%E5%92%8C%E8%B4%9F%E6%95%B4%E6%95%B0%EF%BC%89">验证整数（正整数和负整数）</a> <br>
<a href="#%E9%AA%8C%E8%AF%81%E6%95%B4%E6%95%B0%E5%92%8C%E6%B5%AE%E7%82%B9%E6%95%B0%EF%BC%88%E6%AD%A3%E8%B4%9F%E6%95%B4%E6%95%B0%E5%92%8C%E6%AD%A3%E8%B4%9F%E6%B5%AE%E7%82%B9%E6%95%B0%EF%BC%89">验证整数和浮点数（正负整数和正负浮点数）</a> <br>
<a href="#%E9%AA%8C%E8%AF%81%E7%A9%BA%E7%99%BD%E5%AD%97%E7%AC%A6">验证空白字符</a> <br>
<a href="#%E9%AA%8C%E8%AF%81%E4%B8%AD%E6%96%87">验证中文</a> <br>
<a href="#%E9%AA%8C%E8%AF%81%E8%8B%B1%E6%96%87%E5%BC%80%E5%A4%B4">验证英文开头</a> <br>
<a href="#%E9%AA%8C%E8%AF%81%E6%97%A5%E6%9C%9F%EF%BC%88%E5%B9%B4%E6%9C%88%E6%97%A5%EF%BC%89">验证日期（年月日）</a> <br>
<a href="#%E9%AA%8C%E8%AF%81%E5%AF%86%E7%A0%81%201%E3%80%81%E9%95%BF%E5%BA%A68~16%E4%BD%8D%EF%BC%9B2%E3%80%81%E6%95%B0%E5%AD%97%E3%80%81%E5%AD%97%E6%AF%8D%E3%80%81%E5%AD%97%E7%AC%A6%E8%87%B3%E5%B0%91%E5%8C%85%E5%90%AB%E4%B8%A4%E7%A7%8D">验证密码 1、长度8~16位；2、数字、字母、字符至少包含两种</a> <br>
<a href="#%E9%AA%8C%E8%AF%81URL%E5%9C%B0%E5%9D%80">验证URL地址</a> <br>
<a href="#%E8%8E%B7%E5%8F%96%E7%BD%91%E5%9D%80%20URL%20%E7%9A%84%E4%B8%80%E7%BA%A7%E5%9F%9F%E5%90%8D">获取网址 URL 的一级域名</a> <br>
<a href="#%E5%8C%B9%E9%85%8D%E4%B8%AD%E5%9B%BD%E9%82%AE%E6%94%BF%E7%BC%96%E7%A0%81">匹配中国邮政编码</a> <br>
<a href="#%E5%8C%B9%E9%85%8DIP%E5%9C%B0%E5%9D%80">匹配IP地址</a></p><blockquote data-anchor-id="hxji" class="white-blockquote">
  <p>UUID</p>
</blockquote><p data-anchor-id="dado"><a href="#%E7%94%9F%E6%88%90uuid">生成uuid</a></p><div class="md-section-divider"></div><h3 data-anchor-id="y44f" id="url发送请求">URL发送请求</h3><p data-anchor-id="8tlf">ClientUtil.UrlPostClient(postData, postUrl); <br>
传递值</p><pre data-anchor-id="pryk"><code>  {
    *  String  postData：请求数据       
    *  String  postUrl:请求链接
   }
</code></pre><p data-anchor-id="6ukt">返回值类型</p><pre data-anchor-id="y8oy"><code>  {
    *   String result      
   }
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="yi83" id="httpclient模拟发送http的post请求">httpclient模拟发送http的post请求</h3><p data-anchor-id="4ibj">ClientUtil.httpClientPost(param, url); <br>
传递值</p><pre data-anchor-id="qqd9"><code>  {
    *  Map&lt;String, String&gt; param：请求数据       
    *  String url:请求链接
   }
</code></pre><p data-anchor-id="8m80">返回值类型</p><pre data-anchor-id="gf1s"><code>  {
    *   String       
   }
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="vgei" id="判断该请求是否来自手机终端">判断该请求是否来自手机终端</h3><p data-anchor-id="g93t">DeviceUtil.isMobileDevice(request); <br>
传递值</p><pre data-anchor-id="c5r4"><code>  {
    *  HttpServletRequest request：请求     
   }
</code></pre><p data-anchor-id="1an3">返回值类型</p><pre data-anchor-id="3cmu"><code>  {
    *   boolean      
   }
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="ld5y" id="将list拆分成固定大小的块">将list拆分成固定大小的块</h3><p data-anchor-id="qbbn">CollectionUtil.splitList(list, blockSize); <br>
传递值</p><pre data-anchor-id="8ffe"><code>  {
    *  List&lt;T&gt; list：需要分割的list
    *  int blockSize：每个集合的数据个数
   }
</code></pre><p data-anchor-id="smx3">返回值类型</p><pre data-anchor-id="e73i"><code>  {
    *   List&lt;List&lt;T&gt;&gt;     
   }
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="dtjd" id="获取cookie">获取cookie</h3><p data-anchor-id="sfne">CookieUtil.getCookie(request, cookieName); <br>
传递值</p><pre data-anchor-id="h6sm"><code>  {
    *  HttpServletRequest request：请求
    *  String cookieName：cookie名称
   }
</code></pre><p data-anchor-id="9xue">返回值类型</p><pre data-anchor-id="zkme"><code>  {
    *   String     
   }
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="5kap" id="删除cookie">删除cookie</h3><p data-anchor-id="44il">CookieUtil.delCookie(response, cookieName); <br>
传递值</p><pre data-anchor-id="zvlf"><code>  {
    *  HttpServletResponse response：请求
    *  String cookieName：cookie名称
   }
</code></pre><p data-anchor-id="rsbg">返回值类型</p><pre data-anchor-id="f2j2"><code>  {
    *   void     
   }     
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="5d8v" id="获取当前年的前n年列表">获取当前年的前n年列表</h3><p data-anchor-id="0img">CalendarUtil.getPreYears(n); <br>
传递值</p><pre data-anchor-id="vxe4"><code>  {
    *  int n：年数
   }
</code></pre><p data-anchor-id="tw2x">返回值类型</p><pre data-anchor-id="bky4"><code>  {
    *   List&lt;String&gt; ，string格式yyyy     
   }  
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="zv55" id="获取12个月的集合">获取12个月的集合</h3><p data-anchor-id="rbv5">CalendarUtil.get12MonthStr(); <br>
传递值</p><pre data-anchor-id="nbka"><code>  {
    *  
   }
</code></pre><p data-anchor-id="gfeh">返回值类型</p><pre data-anchor-id="xfmk"><code>  {
    *   List&lt;String&gt; [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]  
   }  
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="ogal" id="获取明天的日期">获取明天的日期</h3><p data-anchor-id="l7d0">CalendarUtil.getNextDay(format) <br>
传递值</p><pre data-anchor-id="pdg6"><code>  {
    *  String format：返回日期的格式
   }
</code></pre><p data-anchor-id="wl75">返回值类型</p><pre data-anchor-id="hpiw"><code>  {
    *   String   
   }
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="dl7z" id="获取指定日期n天后的日期">获取指定日期n天后的日期</h3><p data-anchor-id="trsu">CalendarUtil.getNextNDay(startTime, n); <br>
传递值</p><pre data-anchor-id="w1ah"><code>  {
    *  Date startTime：指定日期
    *  Integer n：天数
   }
</code></pre><p data-anchor-id="40ls">返回值类型</p><pre data-anchor-id="wpol"><code>  {
    *   Date     
   }         
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="6ytz" id="获取指定日期000000时刻的n天后日期">获取指定日期00:00:00时刻的n天后日期</h3><p data-anchor-id="44pk">CalendarUtil.getNextNDayBegin(startTime, n); <br>
传递值</p><pre data-anchor-id="w7to"><code>  {
    *  Date startTime：指定日期
    *  Integer n：天数
   }
</code></pre><p data-anchor-id="j0o1">返回值类型</p><pre data-anchor-id="297p"><code>  {
    *   Date     
   }    
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="em16" id="获取指定日期235959时刻的n天后日期">获取指定日期23:59:59时刻的n天后日期</h3><p data-anchor-id="mki6">CalendarUtil.getNextNDayEnd(startTime, n) <br>
传递值</p><pre data-anchor-id="22qh"><code>  {
    *  Date startTime：指定日期
    *  Integer n：天数
   }
</code></pre><p data-anchor-id="ud6w">返回值类型</p><pre data-anchor-id="8se3"><code>  {
    *   Date     
   }    
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="h7fh" id="获取指定日期n天前的日期">获取指定日期n天前的日期</h3><p data-anchor-id="f4v1">CalendarUtil.getPreNDay(startTime, n); <br>
传递值</p><pre data-anchor-id="ek18"><code>  {
    *  Date startTime：指定日期
    *  Integer n：天数
   }
</code></pre><p data-anchor-id="jcg1">返回值类型</p><pre data-anchor-id="utyg"><code>  {
    *   Date     
   }    
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="jzi1" id="获取指定日期000000时刻的n天前日期">获取指定日期00:00:00时刻的n天前日期</h3><p data-anchor-id="tijd">CalendarUtil.getPreNDayBegin(startTime, n) <br>
传递值</p><pre data-anchor-id="e66z"><code>  {
    *  Date startTime：指定日期
    *  Integer n：天数
   }
</code></pre><p data-anchor-id="eqgg">返回值类型</p><pre data-anchor-id="ye3r"><code>  {
    *   Date     
   }    
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="5561" id="获取指定日期235959时刻的n天前日期">获取指定日期23:59:59时刻的n天前日期</h3><p data-anchor-id="bgb3">CalendarUtil.getPreNDayEnd(startTime, n); <br>
传递值</p><pre data-anchor-id="rwkq"><code>  {
    *  Date startTime：指定日期
    *  Integer n：天数
   }
</code></pre><p data-anchor-id="98p3">返回值类型</p><pre data-anchor-id="nhpx"><code>  {
    *   Date     
   }    
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="po9a" id="获取当前日期前x天的日期">获取当前日期前x天的日期</h3><p data-anchor-id="q6ci">CalendarUtil.getPreXDay(x, format); <br>
传递值</p><pre data-anchor-id="li02"><code>  {
    *  String format：返回日期的格式
    *  int x：天数
   }
</code></pre><p data-anchor-id="v5yc">返回值类型</p><pre data-anchor-id="s0a5"><code>  {
    *   String     
   }           
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="igrm" id="获取当前年">获取当前年</h3><p data-anchor-id="iuts">CalendarUtil.getYear(); <br>
传递值</p><pre data-anchor-id="3vkj"><code>  {
    *
   }
</code></pre><p data-anchor-id="qz5v">返回值类型</p><pre data-anchor-id="ctpp"><code>  {
    *   String     格式yyyy
   }   
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="jbjo" id="获取当前月">获取当前月</h3><p data-anchor-id="bqy5">CalendarUtil.getMonth(); <br>
传递值</p><pre data-anchor-id="w5xx"><code>  {
    *
   }
</code></pre><p data-anchor-id="xbrm">返回值类型</p><pre data-anchor-id="hhls"><code>  {
    *   String     格式MM
   }   
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="43yt" id="获取某年某月的第一天和最后一天时间">获取某年某月的第一天和最后一天时间</h3><p data-anchor-id="0lih">CalendarUtil.getMonthFirstEndDayTime(year, month); <br>
传递值</p><pre data-anchor-id="6ylp"><code>  {
    *  String year：年份
    *  String month：月份
   }
</code></pre><p data-anchor-id="6s0o">返回值类型</p><pre data-anchor-id="3l2i"><code>  {
    *   Map&lt;String, String&gt;  {month_first_day_time=1991-12-01 00:00:00, month_last_day_time=1991-12-31 23:59:59}     
   }   
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="8m6k" id="获取当前月份的前一个月">获取当前月份的前一个月</h3><p data-anchor-id="7lhf">CalendarUtil.getPreMonth(); <br>
传递值</p><pre data-anchor-id="2u01"><code>  {
    *
   }
</code></pre><p data-anchor-id="wsat">返回值类型</p><pre data-anchor-id="am4p"><code>  {
    *   Map&lt;String, String&gt; {month=8, year=2016}     
   }   
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="yvqt" id="获取某年某月的前一个月">获取某年某月的前一个月</h3><p data-anchor-id="22rd">CalendarUtil.getPreMonth(year, month); <br>
传递值</p><pre data-anchor-id="xbyh"><code>  {
    *  String year：年份
    *  String month：月份
   }
</code></pre><p data-anchor-id="27zo">返回值类型</p><pre data-anchor-id="rvgt"><code>  {
    *   Map&lt;String, String&gt; {month=8, year=2016}      
   }   
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="xgno" id="获取开始月份和结束月份中间的所有月份包括开始月份和结束月份">获取开始月份和结束月份中间的所有月份，包括开始月份和结束月份</h3><p data-anchor-id="59pt">CalendarUtil.getBetweenMonths(startMonth, endMonth); <br>
传递值</p><pre data-anchor-id="mdn6"><code>  {
    *  String startMonth：开始月份  格式yyyy-MM
    *  String endMonth：结束月份  格式yyyy-MM
   }
</code></pre><p data-anchor-id="imuf">返回值类型</p><pre data-anchor-id="8tix"><code>  {
    *   List&lt;String&gt;      格式yyyy-MM
   }   
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="ivad" id="获获取日期之间的天list-formt-yyyy-mm-dd">获获取日期之间的天List formt =yyyy-MM-dd</h3><p data-anchor-id="vnoq">CalendarUtil.getBetweenDateStr(startTime, endTime); <br>
传递值</p><pre data-anchor-id="5wrb"><code>  {
    *  String startTime：开始日期 格式yyyy-MM-dd
    *  String endTime：结束日期  格式yyyy-MM-dd
   }
</code></pre><p data-anchor-id="nm5u">返回值类型</p><pre data-anchor-id="pxcf"><code>  {
    *   List&lt;String&gt;      格式yyyy-MM-dd
   }   
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="pvkp" id="获取日期之间的天list-输出指定日期格式">获取日期之间的天List 输出指定日期格式</h3><p data-anchor-id="ezx8">CalendarUtil.getBetweenDateStr(startTime, endTime, format); <br>
传递值</p><pre data-anchor-id="qkfy"><code>  {
    *  String startTime：开始日期 格式yyyy-MM-dd
    *  String endTime：结束日期  格式yyyy-MM-dd
    *  String format：返回日期的格式
   }
</code></pre><p data-anchor-id="f1zg">返回值类型</p><pre data-anchor-id="q3nh"><code>  {
    *   String     
   }   
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="qhdi" id="获取当前日期的前n个月的月份集合闭区间">获取当前日期的前n个月的月份集合（闭区间）</h3><p data-anchor-id="pe07">CalendarUtil.getPreNMonths(curMonth, n) <br>
传递值</p><pre data-anchor-id="8a71"><code>  {
    *  String curMonth：当前日期 格式yyyy-MM-dd或yyyy-MM
    *  Integer n：月份数
   }
</code></pre><p data-anchor-id="w8a5">返回值类型</p><pre data-anchor-id="iwk8"><code>  {
    *   List&lt;String&gt;     格式yyyy-MM
   }   
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="wc4v" id="获取当前天">获取当前天</h3><p data-anchor-id="zym0">CalendarUtil.getToday(format); <br>
传递值</p><pre data-anchor-id="oh0c"><code>  {
    *  String format：返回日期的格式
   }
</code></pre><p data-anchor-id="g1sb">返回值类型</p><pre data-anchor-id="g3da"><code>  {
    *   String     
   }   
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="glur" id="获取当前月的第一天">获取当前月的第一天</h3><p data-anchor-id="etfl">CalendarUtil.getFirstDay(format); <br>
传递值</p><pre data-anchor-id="ujot"><code>  {
    *  String format：返回日期的格式
   }
</code></pre><p data-anchor-id="jocl">返回值类型</p><pre data-anchor-id="1z0q"><code>  {
    *   String     
   }          
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="92lu" id="获取当前月的最后一天">获取当前月的最后一天</h3><p data-anchor-id="13zl">CalendarUtil.getLastDay(format); <br>
传递值</p><pre data-anchor-id="d8z7"><code>  {
    *  String format：返回日期的格式
   }
</code></pre><p data-anchor-id="ymeo">返回值类型</p><pre data-anchor-id="jzw1"><code>  {
    *   String     
   }        
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="ge1w" id="获取当前月的第一天返回date类型">获取当前月的第一天返回Date类型</h3><p data-anchor-id="if3e">CalendarUtil.getFirstDate(); <br>
传递值</p><pre data-anchor-id="rxit"><code>  {
    *  
   }
</code></pre><p data-anchor-id="3r32">返回值类型</p><pre data-anchor-id="4an6"><code>  {
    *   Date     
   }        
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="v1r6" id="获取当前月的最后一天返回date类型">获取当前月的最后一天返回Date类型</h3><p data-anchor-id="e1eo">CalendarUtil.getLastDate(); <br>
传递值</p><pre data-anchor-id="q83a"><code>  {
    *  
   }
</code></pre><p data-anchor-id="g5qx">返回值类型</p><pre data-anchor-id="abln"><code>  {
    *   Date     
   }        
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="nbcc" id="判断日期的天是否一样">判断日期的天是否一样</h3><p data-anchor-id="cpyc">CalendarUtil.isDayEqual(date1, date2); <br>
传递值</p><pre data-anchor-id="96fr"><code>  {
    *  Date date1
    *  Date date2
   }
</code></pre><p data-anchor-id="mvwq">返回值类型</p><pre data-anchor-id="pfct"><code>  {
    *   boolean     
   }        
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="nobt" id="判断两日期间距是否为xx毫秒">判断两日期间距是否为xx毫秒</h3><p data-anchor-id="u5l5">CalendarUtil.isTimeSpace(startTime, endTime, space) <br>
传递值</p><pre data-anchor-id="eldk"><code>  {
    *  Date startTime
    *  Date endTime
    *  long space   毫秒     
   }
</code></pre><p data-anchor-id="xkor">返回值类型</p><pre data-anchor-id="77yr"><code>  {
    *   boolean     
   }        
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="dufw" id="判断两日期间距是否在-startspace毫秒-和-endspace毫秒-之间">判断两日期间距是否在 startSpace毫秒 和 endSpace毫秒 之间</h3><p data-anchor-id="cogx">CalendarUtil.isTimeBetween(startTime, endTime, startSpace, endSpace); <br>
传递值</p><pre data-anchor-id="m5ut"><code>  {
    *  Date startTime
    *  Date endTime
    *  long startSpace   毫秒  
    *  long endSpace   毫秒 
   }
</code></pre><p data-anchor-id="8gm2">返回值类型</p><pre data-anchor-id="ptu7"><code>  {
    *   boolean     
   }        
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="6097" id="判断日期是否在starttime和endtime日期之间">判断日期是否在startTime和endTime日期之间</h3><p data-anchor-id="sp71">CalendarUtil.isTimeBetween(time, startTime, endTime); <br>
传递值</p><pre data-anchor-id="hk4x"><code>  {
    *  Date time
    *  Date startTime
    *  Date endTime
   }
</code></pre><p data-anchor-id="phuv">返回值类型</p><pre data-anchor-id="c5z4"><code>  {
    *   boolean     
   }        
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="ah0y" id="获取日期之间相隔几年">获取日期之间相隔几年</h3><p data-anchor-id="f4ll">CalendarUtil.getYearSpace(startTime, endTime); <br>
传递值</p><pre data-anchor-id="zb9n"><code>  {
    *  Date startTime
    *  Date endTime
   }
</code></pre><p data-anchor-id="0vj2">返回值类型</p><pre data-anchor-id="98wk"><code>  {
    *   Integer     
   }        
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="bk5t" id="获取日期之间天相隔几天">获取日期之间天相隔几天</h3><p data-anchor-id="bqpi">CalendarUtil.getDaySpace(startTime, endTime); <br>
传递值</p><pre data-anchor-id="6p1q"><code>  {
    *  Date startTime
    *  Date endTime
   }
</code></pre><p data-anchor-id="exyl">返回值类型</p><pre data-anchor-id="plhd"><code>  {
    *   Integer     
   }               
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="4lxj" id="获取当前日期-毫秒或时间戳">获取当前日期 毫秒或时间戳</h3><p data-anchor-id="0jjc">CalendarUtil.getTimeInMillis(); <br>
传递值</p><pre data-anchor-id="6a3b"><code>  {
    *  
   }
</code></pre><p data-anchor-id="m4e6">返回值类型</p><pre data-anchor-id="xhw7"><code>  {
    *   long     
   }     
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="909z" id="获取当前日期-秒">获取当前日期 秒</h3><p data-anchor-id="wfa2">CalendarUtil.getTimeInSeconds(); <br>
传递值</p><pre data-anchor-id="kccy"><code>  {
    * 
   }
</code></pre><p data-anchor-id="ymqp">返回值类型</p><pre data-anchor-id="xd9u"><code>  {
    *   long     
   }     
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="clij" id="本地文件上传">本地文件上传</h3><p data-anchor-id="63xp">FileUtil.uploadFile(fis, path); <br>
传递值</p><pre data-anchor-id="2op8"><code>  {
    *   InputStream fis ：文件流
    *   String path：文件上传本地路径
   }
</code></pre><p data-anchor-id="fo6f">返回值类型</p><pre data-anchor-id="d942"><code>  {
    *   boolean     
   }     
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="mlkk" id="生成本地文件">生成本地文件</h3><p data-anchor-id="tgq4">FileUtil.createFile(filepath, content); <br>
传递值</p><pre data-anchor-id="de2u"><code>  {
    *   String content ：文件内容
    *   String filepath：生成本地文件路径
   }
</code></pre><p data-anchor-id="bu63">返回值类型</p><pre data-anchor-id="imj6"><code>  {
    *  File    
   }     
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="3jn0" id="ftp上传文件">ftp上传文件</h3><p data-anchor-id="2kxy">FtpUtil.addfile(fis, propPath, filename, address); <br>
传递值</p><pre data-anchor-id="0ts0"><code>  {
    *   InputStream fis ：文件流
    *   String propPath ：ftp配置文件路径
    *   String filename ：生成文件名称
    *   String address  ：文件存放在ftp的目录
   }
</code></pre><p data-anchor-id="q1fr">返回值类型</p><pre data-anchor-id="lxhw"><code>  {
    *   boolean     
   }     
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="pyvt" id="ftp删除文件">ftp删除文件</h3><p data-anchor-id="x7mm">FtpUtil.deletefile(propPath, filename, address); <br>
传递值</p><pre data-anchor-id="7cue"><code>  {
    *   String propPath ：ftp配置文件路径
    *   String filename ：删除文件名称
    *   String address  ：文件存放在ftp的目录
   }
</code></pre><p data-anchor-id="nll5">返回值类型</p><pre data-anchor-id="vdb3"><code>  {
    *   boolean     
   }     
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="n1em" id="md5加密">md5加密</h3><p data-anchor-id="gvne">EncryptUtil.encodedByMD5(source); <br>
传递值</p><pre data-anchor-id="edmh"><code>  {
    *   String source ：需要加密的字符串
   }
</code></pre><p data-anchor-id="jwkv">返回值类型</p><pre data-anchor-id="twq8"><code>  {
    *   String     
   }     
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="94ot" id="sha-1加密">SHA-1加密</h3><p data-anchor-id="gi1a">EncryptUtil.encryptSHA1(content); <br>
传递值</p><pre data-anchor-id="brz3"><code>  {
    *   String content  ：需要加密的字符串
   }
</code></pre><p data-anchor-id="uijv">返回值类型</p><pre data-anchor-id="r2om"><code>  {
    *   String     
   }     
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="zijm" id="使用aes模式加密">使用AES模式加密</h3><p data-anchor-id="0tbg">EncryptUtil.encryptByAes(content, password); <br>
传递值</p><pre data-anchor-id="swa2"><code>  {
    *   String content  ：需要加密的字符串
    *   String password ：秘钥
   }
</code></pre><p data-anchor-id="r7vp">返回值类型</p><pre data-anchor-id="jd6o"><code>  {
    *   byte[]     
   }     
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="ds73" id="解密aes模式的加密">解密AES模式的加密</h3><p data-anchor-id="g56l">EncryptUtil.deEncryptByAes(content, password); <br>
传递值</p><pre data-anchor-id="arri"><code>  {
    *   byte[] content ：待解密内容 
    *   String password ：秘钥
   }
</code></pre><p data-anchor-id="hq04">返回值类型</p><pre data-anchor-id="vfu6"><code>  {
    *   byte[]     
   }     
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="7x0a" id="获取配置文件">获取配置文件</h3><p data-anchor-id="kdpc">PropertyUtil.getProp(file); <br>
传递值</p><pre data-anchor-id="pr4b"><code>  {
    *   String file:配置文件路径
   }
</code></pre><p data-anchor-id="8nne">返回值类型</p><pre data-anchor-id="9kc2"><code>  {
    *   Properties     
   }          
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="yfi7" id="根据时间生成唯一编码考虑并发">根据时间生成唯一编码(考虑并发)</h3><p data-anchor-id="9p1g">RandomUtil.timeUinqueNumber(); <br>
传递值</p><pre data-anchor-id="sda4"><code>  {
    *   
   }
</code></pre><p data-anchor-id="zzk0">返回值类型</p><pre data-anchor-id="82py"><code>  {
    *   long     

   }          
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="qsyl" id="生成长度为length的字符串">生成长度为length的字符串</h3><p data-anchor-id="97hh">RandomUtil.CreateNoncestr(length); <br>
传递值</p><pre data-anchor-id="heqs"><code>  {
    *   int length:生成字符串长度
   }
</code></pre><p data-anchor-id="o2p8">返回值类型</p><pre data-anchor-id="wv4a"><code>  {
    *   String     
   }                 
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="x7lj" id="获取指定区间的随机数">获取指定区间的随机数</h3><p data-anchor-id="8hsq">RandomUtil.randomCode(min, max); <br>
传递值</p><pre data-anchor-id="w8tc"><code>  {
    *   int min :    最小值
    *   int max：    最大值
   }
</code></pre><p data-anchor-id="31ai">返回值类型</p><pre data-anchor-id="hm4g"><code>  {
    *   int     
   }                 
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="079h" id="获取随机色">获取随机色</h3><p data-anchor-id="naun">RandomUtil.getRandColor(fc, bc); <br>
传递值</p><pre data-anchor-id="vyeu"><code>  {
    *   int fc:
    *   int bc：
    *   要求     0&lt;fc&lt;bc&lt;255
   }
</code></pre><p data-anchor-id="w5ok">返回值类型</p><pre data-anchor-id="3zg5"><code>  {
    *   Color     
   }                 
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="ux7v" id="获取长度n的随机数字符串">获取长度n的随机数字符串</h3><p data-anchor-id="tqez">RandomUtil.getRandomNumber(length); <br>
传递值</p><pre data-anchor-id="ju9f"><code>  {
    *   int length:生成数字长度
   }
</code></pre><p data-anchor-id="z3th">返回值类型</p><pre data-anchor-id="79np"><code>  {
    *   String     
   }                 
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="08o6" id="map按键进行的ascii-码从小到大排序字典序后将键值对按key1value1key2value2拼接">map按键进行的ASCII 码从小到大排序（字典序）后，将键值对按key1=value1&amp;key2=value2…拼接</h3><p data-anchor-id="fvdw">AllTypeSort.MapSortByKey(parameters); <br>
传递值</p><pre data-anchor-id="vj9y"><code>  {
    *   HashMap&lt;String, String&gt; parameters  ：  需要排序的map
   }
</code></pre><p data-anchor-id="xpxp">返回值类型</p><pre data-anchor-id="dsr7"><code>  {
    *   String     
   }                 
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="l53o" id="map按值进行的ascii-码从小到大排序字典序后将键值对按key1value1key2value2拼接">map按值进行的ASCII 码从小到大排序（字典序）后，将键值对按key1=value1&amp;key2=value2…拼接</h3><p data-anchor-id="vo6k">AllTypeSort.MapSortByValue(parameters); <br>
传递值</p><pre data-anchor-id="7q06"><code>  {
    *   HashMap&lt;String, String&gt; parameters  ：  需要排序的map
   }
</code></pre><p data-anchor-id="20kf">返回值类型</p><pre data-anchor-id="v9la"><code>  {
    *   String     
   }          
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="nbyo" id="将map按键从小到大排序">将map按键从小到大排序</h3><p data-anchor-id="z6nm">AllTypeSort.sortMapByKey(map); <br>
传递值</p><pre data-anchor-id="uw31"><code>  {
    *   Map&lt;String, T&gt; map  ：  需要排序的map
   }
</code></pre><p data-anchor-id="maz0">返回值类型</p><pre data-anchor-id="auix"><code>  {
    *   Map&lt;String, T&gt;     
   }                 
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="fgvn" id="将map按键从大到小排序">将map按键从大到小排序</h3><p data-anchor-id="tquu">AllTypeSort.sortMapByKeyDesc(map); <br>
传递值</p><pre data-anchor-id="tojh"><code>  {
    *   Map&lt;String, T&gt; map  ：  需要排序的map
   }
</code></pre><p data-anchor-id="i900">返回值类型</p><pre data-anchor-id="cqtd"><code>  {
    *  Map&lt;String, T&gt;       
   }                 
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="awuu" id="将list按值从小到大排序">将List按值从小到大排序</h3><p data-anchor-id="0dd4">AllTypeSort.sortListByValueString(list); <br>
传递值</p><pre data-anchor-id="zacs"><code>  {
    *   List&lt;String&gt; list   
   }
</code></pre><p data-anchor-id="9rfq">返回值类型</p><pre data-anchor-id="u37s"><code>  {
    *  List&lt;String    
   }                      
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="9o6n" id="将list按值从大到小排序">将List按值从大到小排序</h3><p data-anchor-id="gkyq">AllTypeSort.sortListByValueStringDesc(list); <br>
传递值</p><pre data-anchor-id="f7lm"><code>  {
    *   List&lt;String&gt; list
   }
</code></pre><p data-anchor-id="773z">返回值类型</p><pre data-anchor-id="ddqb"><code>  {
    *   List&lt;String&gt;    
   }    
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="pspk" id="map转成xml">Map转成xml</h3><p data-anchor-id="fvkg">TransType.mapToXml(arr); <br>
传递值</p><pre data-anchor-id="57y1"><code>  {
    *   HashMap&lt;String, String&gt; arr
   }
</code></pre><p data-anchor-id="g7jl">返回值类型</p><pre data-anchor-id="k4yb"><code>  {
    *   String   
   }                    
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="27b2" id="将xml字符串转换成map">将xml字符串转换成Map</h3><p data-anchor-id="nt7g">TransType.xmlToMap(xml); <br>
传递值</p><pre data-anchor-id="yl3o"><code>  {
    *   String xml
   }
</code></pre><p data-anchor-id="e9qi">返回值类型</p><pre data-anchor-id="l4ol"><code>  {
    *   Map     
   }                    
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="h7nf" id="将json字符串转换为指定类型的对象">将json字符串转换为指定类型的对象</h3><p data-anchor-id="gr16">TransType.jsonToObject(json, classType); <br>
传递值</p><pre data-anchor-id="s7wd"><code>  {
    *   String json :json字符串
    *   Class&lt;T&gt; classType  ：指定类型
   }
</code></pre><p data-anchor-id="72jg">返回值类型</p><pre data-anchor-id="f7mf"><code>  {
    *   T    
   }                    
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="7g51" id="将对象转换为json字符串">将对象转换为json字符串</h3><p data-anchor-id="r6wn">TransType.objectToJson(object); <br>
传递值</p><pre data-anchor-id="im88"><code>  {
    *   Object object
   }
</code></pre><p data-anchor-id="lrq0">返回值类型</p><pre data-anchor-id="dtda"><code>  {
    *   String    
   }                    
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="ictb" id="将对象转为map">将对象转为map</h3><p data-anchor-id="82rw">TransType.beanToMap(obj); <br>
传递值</p><pre data-anchor-id="uyjg"><code>  {
    *   Object obj
   }
</code></pre><p data-anchor-id="sqqk">返回值类型</p><pre data-anchor-id="xtbi"><code>  {
    *   Map&lt;String, Object&gt;     
   }                    
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="b352" id="将map转换为bean">将map转换为bean</h3><p data-anchor-id="ftot">TransType.mapToBean(clazz, map); <br>
传递值</p><pre data-anchor-id="cre2"><code>  {
    *   Class&lt;T&gt; clazz
    *   Map&lt;String, Object&gt; map
   }
</code></pre><p data-anchor-id="m90g">返回值类型</p><pre data-anchor-id="tn8c"><code>  {
    *   T     
   }                    
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="xogt" id="将maplist转换为beanlist">将maplist转换为beanlist</h3><p data-anchor-id="nqbd">TransType.mapListToBeanList(clazz, mapList); <br>
传递值</p><pre data-anchor-id="euud"><code>  {
    *   Class&lt;T&gt; clazz
    *   List&lt;Map&lt;String, Object&gt;&gt;   mapList
   }
</code></pre><p data-anchor-id="ze7y">返回值类型</p><pre data-anchor-id="35go"><code>  {
    *   List&lt;T&gt;   
   }      
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="sa2r" id="转换有下划线的string-第一个字母大写-下划线的后一个字母大写">转换有下划线的String 第一个字母大写 下划线的后一个字母大写</h3><p data-anchor-id="sr4x">TransType.columnToField2(str); <br>
传递值</p><pre data-anchor-id="2kxr"><code>  {
    *   String str
   }
</code></pre><p data-anchor-id="mfsb">返回值类型</p><pre data-anchor-id="s4wj"><code>  {
    *   String     
   }             
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="f8e8" id="转换将第一个字母大写变成小写-并在前面加下划线">转换将第一个字母大写变成小写 并在前面加下划线</h3><p data-anchor-id="ot6c">TransType.fieldToColumn(str); <br>
传递值</p><pre data-anchor-id="fs5i"><code>  {
    *  String str
   }
</code></pre><p data-anchor-id="6d2y">返回值类型</p><pre data-anchor-id="nkvq"><code>  {
    *   String    
   }             
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="40yr" id="首字母变大写">首字母变大写</h3><p data-anchor-id="hrjp">TransType.upperCaseFirst(str); <br>
传递值</p><pre data-anchor-id="90hx"><code>  {
    *   String str
   }
</code></pre><p data-anchor-id="8smz">返回值类型</p><pre data-anchor-id="h7xz"><code>  {
    *   String     
   }             
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="xqdr" id="首字母变小写">首字母变小写</h3><p data-anchor-id="ti1j">TransType.lowerCaseFirst(str); <br>
传递值</p><pre data-anchor-id="m864"><code>  {
    *   String str
   }
</code></pre><p data-anchor-id="g9cn">返回值类型</p><pre data-anchor-id="yiie"><code>  {
    *   String     
   }         
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="61xz" id="字符串中字符替换替换">字符串中字符替换(&lt;,&gt;,&amp;,""替换)</h3><p data-anchor-id="5s8j">HtmlUtil.htmlEncode(source); <br>
传递值</p><pre data-anchor-id="jgdw"><code>  {
    *  String source
   }
</code></pre><p data-anchor-id="5ajh">返回值类型</p><pre data-anchor-id="q198"><code>  {
    *   String     
   }               
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="958y" id="html标签内容提取">html标签内容提取</h3><p data-anchor-id="zst0">HtmlUtil.filterHtml(source); <br>
传递值</p><pre data-anchor-id="uwqp"><code>  {
    *   String source
   }
</code></pre><p data-anchor-id="mbrn">返回值类型</p><pre data-anchor-id="stxu"><code>  {
    *   String     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="uanq" id="判断字符串是否是数字字符串">判断字符串是否是数字字符串</h3><p data-anchor-id="pqyv">ValidatorUtil.IsNumeric(str); <br>
传递值</p><pre data-anchor-id="iu3w"><code>  {
    *   String str
   }
</code></pre><p data-anchor-id="fr7z">返回值类型</p><pre data-anchor-id="pfre"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="fgxe" id="字符串对象是否为空null或">字符串对象是否为空(null或"")</h3><p data-anchor-id="g7w9">ValidatorUtil.isBlank(value); <br>
传递值</p><pre data-anchor-id="vqun"><code>  {
    *   String value
   }
</code></pre><p data-anchor-id="84t7">返回值类型</p><pre data-anchor-id="ptwi"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="7cil" id="目标字符串是否不为空">目标字符串是否不为空</h3><p data-anchor-id="ap05">ValidatorUtil.isNotBlank(value); <br>
传递值</p><pre data-anchor-id="cscr"><code>  {
    *   isNotBlank
   }
</code></pre><p data-anchor-id="gy03">返回值类型</p><pre data-anchor-id="081j"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="8wzu" id="验证email">验证Email</h3><p data-anchor-id="8wua">ValidatorUtil.validEmail(email); <br>
传递值</p><pre data-anchor-id="k0cv"><code>  {
    *   String email
   }
</code></pre><p data-anchor-id="ba2m">返回值类型</p><pre data-anchor-id="e5jr"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="v4qq" id="验证身份证号码">验证身份证号码</h3><p data-anchor-id="n1uk">ValidatorUtil.validIdCard(idCard); <br>
传递值</p><pre data-anchor-id="bh4s"><code>  {
    *   String idCard
   }
</code></pre><p data-anchor-id="jtn3">返回值类型</p><pre data-anchor-id="6dit"><code>  {
    *   boolean     
   }         
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="h3en" id="验证手机号码">验证手机号码</h3><p data-anchor-id="ma9t">ValidatorUtil.validMobile(mobile); <br>
传递值</p><pre data-anchor-id="4qyl"><code>  {
    *   String mobile
   }
</code></pre><p data-anchor-id="3vik">返回值类型</p><pre data-anchor-id="khnk"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="uvs0" id="验证固定电话号码">验证固定电话号码</h3><p data-anchor-id="ui7a">ValidatorUtil.validPhone(phone); <br>
传递值</p><pre data-anchor-id="z7vd"><code>  {
    *   String phone
   }
</code></pre><p data-anchor-id="3ncs">返回值类型</p><pre data-anchor-id="7oy8"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="if26" id="验证整数正整数和负整数">验证整数（正整数和负整数）</h3><p data-anchor-id="8cql">ValidatorUtil.validDigit(digit); <br>
传递值</p><pre data-anchor-id="wbj0"><code>  {
    *   String digit
   }
</code></pre><p data-anchor-id="mf4s">返回值类型</p><pre data-anchor-id="r024"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="q61j" id="验证整数和浮点数正负整数和正负浮点数">验证整数和浮点数（正负整数和正负浮点数）</h3><p data-anchor-id="33ia">ValidatorUtil.validDecimals(decimals); <br>
传递值</p><pre data-anchor-id="8ilu"><code>  {
    *   String decimals
   }
</code></pre><p data-anchor-id="ib1a">返回值类型</p><pre data-anchor-id="wdn8"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="jab1" id="验证空白字符">验证空白字符</h3><p data-anchor-id="nxdu">ValidatorUtil.validBlankSpace(blankSpace); <br>
传递值</p><pre data-anchor-id="r0vj"><code>  {
    *   String blankSpace
   }
</code></pre><p data-anchor-id="bbau">返回值类型</p><pre data-anchor-id="yqow"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="u7a8" id="验证中文">验证中文</h3><p data-anchor-id="90yn">ValidatorUtil.validChinese(chinese); <br>
传递值</p><pre data-anchor-id="4lwz"><code>  {
    *   String chinese
   }
</code></pre><p data-anchor-id="j81i">返回值类型</p><pre data-anchor-id="am35"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="g3ba" id="验证英文开头">验证英文开头</h3><p data-anchor-id="krgu">ValidatorUtil.validEnStart(String str); <br>
传递值</p><pre data-anchor-id="7nut"><code>  {
    *   String str
   }
</code></pre><p data-anchor-id="tzlf">返回值类型</p><pre data-anchor-id="49ra"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="cxg0" id="验证日期年月日">验证日期（年月日）</h3><p data-anchor-id="rnt3">ValidatorUtil.validBirthday(birthday); <br>
传递值</p><pre data-anchor-id="vtgh"><code>  {
    *   String birthday
   }
</code></pre><p data-anchor-id="ivkx">返回值类型</p><pre data-anchor-id="kkde"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="ced8" id="验证密码-1长度816位2数字字母字符至少包含两种">验证密码 1、长度8~16位；2、数字、字母、字符至少包含两种</h3><p data-anchor-id="e1l0">ValidatorUtil.validPassword(password); <br>
传递值</p><pre data-anchor-id="8947"><code>  {
    *   String password
   }
</code></pre><p data-anchor-id="0ux1">返回值类型</p><pre data-anchor-id="55td"><code>  {
    *   boolean     
   }     
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="8lwr" id="验证url地址">验证URL地址</h3><p data-anchor-id="nuno">ValidatorUtil.validURL(url); <br>
传递值</p><pre data-anchor-id="q9r9"><code>  {
    *   String url
   }
</code></pre><p data-anchor-id="eydt">返回值类型</p><pre data-anchor-id="xkd5"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="uyjk" id="获取网址-url-的一级域名">获取网址 URL 的一级域名</h3><p data-anchor-id="xd82">ValidatorUtil.getDomain(url); <br>
传递值</p><pre data-anchor-id="lkvf"><code>  {
    *   String url
   }
</code></pre><p data-anchor-id="m79e">返回值类型</p><pre data-anchor-id="0v1z"><code>  {
    *   String     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="82cd" id="匹配中国邮政编码">匹配中国邮政编码</h3><p data-anchor-id="xrhr">ValidatorUtil.validPostcode(postcode); <br>
传递值</p><pre data-anchor-id="s22e"><code>  {
    *   String postcode
   }
</code></pre><p data-anchor-id="jf03">返回值类型</p><pre data-anchor-id="5ujb"><code>  {
    *   boolean     
   }                
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="t7q4" id="匹配ip地址">匹配IP地址</h3><p data-anchor-id="5gn4">validIpAddress(ipAddress); <br>
传递值</p><pre data-anchor-id="dpld"><code>  {
    *   String ipAddress
   }
</code></pre><p data-anchor-id="j3pz">返回值类型</p><pre data-anchor-id="8rt4"><code>  {
    *   boolean     
   }         
</code></pre><div class="md-section-divider"></div><h3 data-anchor-id="9zi4" id="生成uuid">生成uuid</h3><p data-anchor-id="e3b3">UuidUtil.getUuid(); <br>
传递值</p><pre data-anchor-id="4swe"><code>  {
    *  
   }
</code></pre><p data-anchor-id="ua1j">返回值类型</p><pre data-anchor-id="dsij"><code>  {
    *   String     
   }         
</code></pre></div>
</body>
</html>